<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>正则表达式中初识原子组</title>
</head>
<body>
    <script>
        let hd = `
        <h1>hooudunren.com</h1>
        <h2>hdms</h2>
        `;

        let reg = /<(h[1-6])>[\s\S]*<\/\1>/;
        // 打印结果中1表示原子组匹配的元素，groups是给原子组起的别名，index表示从第几个字符开始的
        console.dir(hd.match(reg));
    </script>
</body>
</html>